package com.ph.irp.base.materialassistantattribute.action;

import java.util.List;

import com.ph.irp.base.materialassistantattribute.service.AssistantAttributeTypeService;
import com.ph.irp.model.PBaseMaterialAssistantattributetype;

public class AssistantAttributeTypeAction {
	private String FORWARD = null;
	private AssistantAttributeTypeService attributeTypeService;
	private PBaseMaterialAssistantattributetype typeModel;
	private String[] rowlist;
	private List<PBaseMaterialAssistantattributetype> list;
	private int attributeBasicType;

	public int getAttributeBasicType() {
		return attributeBasicType;
	}

	public void setAttributeBasicType(int attributeBasicType) {
		this.attributeBasicType = attributeBasicType;
	}

	public List<PBaseMaterialAssistantattributetype> getList() {
		return list;
	}

	public void setList(List<PBaseMaterialAssistantattributetype> list) {
		this.list = list;
	}

	public AssistantAttributeTypeService getAttributeTypeService() {
		return attributeTypeService;
	}

	public void setAttributeTypeService(
			AssistantAttributeTypeService attributeTypeService) {
		this.attributeTypeService = attributeTypeService;
	}

	public PBaseMaterialAssistantattributetype getTypeModel() {
		return typeModel;
	}

	public void setTypeModel(PBaseMaterialAssistantattributetype typeModel) {
		this.typeModel = typeModel;
	}

	public String[] getRowlist() {
		return rowlist;
	}

	public void setRowlist(String[] rowlist) {
		this.rowlist = rowlist;
	}

	/*
	 * 选择页面调用的方法
	 */
	public String attributeTypeSelect() throws Throwable {
		PBaseMaterialAssistantattributetype model = new PBaseMaterialAssistantattributetype();
		list = attributeTypeService.getAllAttributeType(model);
		FORWARD = "success";

		return FORWARD;
	}

	/*
	 * 根据基本类型查询
	 */
	public String showAttributeBasicTypeList() throws Throwable {
		list = attributeTypeService.getBasic(0);
		FORWARD = "success";

		return FORWARD;
	}

	public String getAttributeBasicTypeByCondition() throws Throwable {
		list = attributeTypeService.getAllAttributeType(typeModel);
		FORWARD = "success";

		return FORWARD;
	}

	public String addAttributeBasicType() throws Throwable {
		attributeTypeService.addAttributeType(typeModel);
		FORWARD = "success";

		return FORWARD;
	}

	public String showEditAttributeBasicType() throws Throwable {
		typeModel = attributeTypeService.getAttributeTypeById(Integer
				.valueOf((String) rowlist[0]));
		FORWARD = "success";

		return FORWARD;
	}

	public String editAttributeBasicType() throws Throwable {
		attributeTypeService.updateAttributeType(typeModel);
		FORWARD = "success";

		return FORWARD;
	}

	/*
	 * 删除一条或者多条记录
	 */
	public String deleteAttributeBasicType() throws Throwable {
		attributeTypeService.deleteAttributeType(rowlist);

		FORWARD = "success";
		return FORWARD;
	}
	
}
